home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18392 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: newshost.gu.edu.au!usenet
  2. From: Student (Student)
  3. Newsgroups: comp.lang.c++,comp.lang.c
  4. Subject: Re: C++ Programming Question From Dummy(s)
  5. Date: 20 Apr 1996 07:18:46 GMT
  6. Organization: Griffith University
  7. Message-ID: <4la34m$k5q@griffin.itc.gu.edu.au>
  8. References: <4l81i1$2uq@murphy2.servtech.com>
  9. NNTP-Posting-Host: enslab13.student.gu.edu.au
  10. X-Newsreader: WinVN 0.92.5
  11.  
  12. In article <4l81i1$2uq@murphy2.servtech.com>, joeypoey@servtech.com (Joey) says:
  13.  
  14. >write a program that 1) reads text from a file(one word so happens) and then 
  15. >2) opens another file and searchs to see if that word is within the 2nd file 
  16. >which is NOT one word but a series of ONE line entries with about 5 words/#'s 
  17. >in each line.  
  18.  
  19. Tim's cool word grabing algorithm:
  20.  goto start of word in file #1
  21.  read character from file #1
  22.  if character not ' ' then add character to buffer
  23.  else word = buffer
  24.  
  25. Tim's cool word finding algorithm:
  26.  open file #2
  27.  goto start of file #2
  28.  Loop:
  29.   if eof(2) exit "not found"
  30.   compare character from file #2 with the first character of word.
  31.   if match then compare secondletter with next position
  32.   and so forth until end of word -> exit "found"
  33.   increment position in file #2
  34.  EndLoop
  35. /* please don't anyone say I should have used recursion unless
  36.          it is reallly necessary for their health       */
  37.  
  38.  
  39. the commands you will be using are your file i/o commands in <dos.h>
  40. so if your not sure about them, click your right mouse button
  41. (in the c environment) and you should get a help index.
  42. then type dos.h <enter>
  43. and it will list the commands contained in this file.
  44. you can then look at the examples and so forth.......
  45. hope this is sort of what you were asking about,
  46. if not then write back an complain.
  47.  
  48.  
  49. >
  50. >Anyone willing to discuss some bare bones basics via E-Mail with me?  Would 
  51.  
  52. sure.... my email is tpratley@cit.gu.edu.au,
  53. but why not just have a group discussion here?
  54.